<?php
/**
 * @file fashionwearproperty.php
 * @author CaoQicheng
 * @date 2016年12月22日 上午18:38:19
 * @brief 
 */
namespace haibao\cms\data\fashionwear;

class FashionWearProperty extends \haibao\cms\data\BaseMysql{

    public function __construct(){
        parent::__construct('\haibao\cms\model\data\fashionwear\FashionWearProperty');
    }

    public function updateCommentNum($fashionWearId,$num = 1,$isSub=false){
    	if ($isSub){
    		$sql = 'update FashionWearProperty set CommentNum=CommentNum+'.$num.' where FashionWearId=%s';
    	}else {
    		$sql = 'update FashionWearProperty set CommentNum=CommentNum-'.$num.' where FashionWearId=%s';
    	}
    	$this->query($sql,array($fashionWearId));
    }

	public function addClickNum($fashionWearId){
		$sql = 'update FashionWearProperty set PcClickNum = PcClickNum + 1 where FashionWearId = %s';
		$result = $this->query($sql,array($fashionWearId));
		if(!$result->getAffectRow()){
			$sql = 'insert into FashionWearProperty (FashionWearId,PcClickNum) VALUES (%s,1)';
			$this->query($sql,array($fashionWearId));
		}
	}
}